package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import dao.SelectDao;
import pojo.GuestDto;

public class SelectInfoServlet extends HttpServlet {
	public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
		String selectType = request.getParameter("selectWhich");
		String status = request.getParameter("guestStatus");
		String content = request.getParameter("selectName");
		System.out.println("selectWhich"+selectType);
		System.out.println("guestStatus"+status);
		System.out.println("content"+content);
		
		SelectDao select = new SelectDao();
		List<GuestDto> list1 = select.personinfo(selectType, status, content);
		List<GuestDto> list  = select.selectRoom(list1);
		if(list == null || list.size() == 0){
			System.out.println("listnull");
		}else{
			for(int i=0;i<list.size();i++)
			{
				System.out.println(list.get(i).name);
				System.out.println(list.get(i).sex);
				System.out.println(list.get(i).id);
				System.out.println(list.get(i).personId);
				System.out.println(list.get(i).day);
				System.out.println("roomNum"+list.get(i).roomNum);
			}
		}
		HttpSession session = request.getSession();
		session.setAttribute("selectGuest", list);
		response.sendRedirect("/hotel/selectInformation.jsp");
		
	}
}
